package routers

import (
	"github.com/astaxie/beego"
	"magiciterm/controllers/api"
	"magiciterm/controllers/index"
)

func init() {

	beego.Router("/", &index.IndexController{}, "*:Index")

	beego.Router("/api/", &api.IndexController{}, "*:Index")
	beego.Router("/api/:urlname(.+)", &api.IndexController{}, "*:Index")

	beego.Router("/api/post/get/", &api.PostController{}, "*:GetPosts")

	beego.Router("/api/post/get/:pid:int", &api.PostController{}, "*:GetPost")
	beego.Router("/api/post/get/:urlname(.+)", &api.PostController{}, "*:GetPost")

	beego.Router("/api/post/del/:pid:int", &api.PostController{}, "*:DelPost")
	beego.Router("/api/post/del/:urlname(.+)", &api.PostController{}, "*:DelPost")

	beego.Router("/api/post/add/", &api.PostController{}, "*:AddPost")
	beego.Router("/api/post/add/test/", &api.PostController{}, "*:AddPostTest")
}
